package com.wu.other.priorityQueue;

import com.rabbitmq.client.*;
import com.wu.rabbitmq.utils.RabbitMQUtils;

/**
 * @program: RabbitMQ-Study
 * @author: 吴磊
 * @create: 2021-12-12 17:52
 */
public class Consumer {
    /**
     * 队列名称  priority-queue
     */
    private static final String QUEUE_NAME = "priority-queue";

    public static void main(String[] args) throws Exception {
        Channel channel = RabbitMQUtils.getChannel();
        DeliverCallback deliverCallback = (consumerTag, delivery) -> {
            String message = new String(delivery.getBody());
            System.out.println(message);
        };
        CancelCallback cancelCallback = consumerTag -> System.out.println("消息消费被中断");
        channel.basicConsume(QUEUE_NAME, true, deliverCallback, cancelCallback);
    }
}
